package com.zkx.mvp.model.base;

import com.zkx.mvp.api.Constant;

import java.io.Serializable;
import java.util.List;

/**
 * Author：zhangkx on 2017/6/16 16:42
 * Email：zkx9025@163.com
 */

public class HttpResultList<T> implements Serializable {

    /**
     * 返回状态
     */
    private int ret;
    /**
     * 提示信息
     */
    private String msg;
    /**
     * 数据
     */
    private List<T> data;

    public int getRet() {
        return ret;
    }

    public void setRet(int ret) {
        this.ret = ret;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    /**
     * API是否请求成功
     *
     * @return 失败返回false, 成功返回true
     */
    public boolean isSuccess() {
        return ret == Constant.WEB_RESP_CODE_SUCCESS;
    }

    @Override
    public String toString() {
        return "HttpResultList{" +
                "ret=" + ret +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
